/*
 * Copyright (c) 2024. hallele, Inc All rights reserved.
 */

package cn.hallele.ms.portalcenter.integration.action.tenant;

import cn.hallele.mc.sdk.usercenter.dto.TenantDTO;
import cn.hallele.mc.sdk.usercenter.dto.TenantQueryDTO;
import cn.hallele.mc.sdk.usercenter.feign.TenantFeign;
import cn.hallele.ms.infrastructure.util.OutGoingUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * hallele_ms_portalcenter
 *
 * @author anle5
 * @since 2024/10/6 13:16
 */
@Slf4j
@Service
public class TenantIntegrationService {
    @Autowired
    private TenantFeign tenantFeign;

    /**
     * 获取 租户列表
     *
     * @param condition 查询条件
     * @return List
     */
    public List<TenantDTO> findAll(TenantDTO condition) {
        return OutGoingUtil.getData(tenantFeign.findAll(condition));
    }

    /**
     * 获取 租户列表
     *
     * @param condition 查询条件
     * @return List
     */
    public List<TenantDTO> findAllMoreCondition(TenantQueryDTO condition) {
        return OutGoingUtil.getData(tenantFeign.findAllMoreCondition(condition));
    }

    /**
     * 添加租户
     *
     * @param tenantDTO tenantDTO
     */
    public void addTenant(TenantDTO tenantDTO) {
        tenantFeign.addTenant(tenantDTO);
    }

    /**
     * 修改租户
     *
     * @param tenantDTO tenantDTO
     */
    public void updateTenant(TenantDTO tenantDTO) {
        tenantFeign.updateTenant(tenantDTO);
    }

    /**
     * 获取租户详情
     *
     * @param id id
     * @return TenantDTO
     */
    public TenantDTO getTenant(Integer id) {
        return OutGoingUtil.getData(tenantFeign.getTenant(id));
    }

    /**
     * 删除租户
     *
     * @param ids ids
     */
    public void deleteTenant(List<Integer> ids) {
        tenantFeign.deleteTenant(ids);
    }
}
